from openpyxl import load_workbook
wb = load_workbook("test2.xlsx")
s = wb.sheetnames[0]
ws = wb[s]
ws.delete_rows(2) # 删除2上面的一行
ws.delete_cols(2) # 删除2左边的一行
wb.save("test2.xlsx")


# 获取最大行和最大列
rows = ws.max_row
cols = ws.max_column
print(rows)
print(cols)